package com.example.firstdemo.network.api.user

import com.example.firstdemo.network.service.RetrofitService
import kotlinx.serialization.Serializable
import retrofit2.http.Body
import retrofit2.http.GET
import retrofit2.http.POST


@Serializable
data class LoginRequest(
    val username: String,
    val password: String
)

@Serializable
data class LoginResponse(
    val code: Int,
    val msg: String,
    val token: String? = null
)

interface UserInterface {
    @POST("login")
    suspend fun login(
        @Body data: LoginRequest
    ): LoginResponse

    @GET("getInfo")
    suspend fun getInfo(
    ): UserInfoResponse
}

object UserApi : UserInterface by RetrofitService.create()